package pers.cz.node;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import pers.cz.mxgraph.MxCell;
import pers.cz.selenium.core.SeleniumChromeFactory;
import pers.cz.selenium.core.SeleniumFactory;
import pers.cz.thread.ThreadUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: Reids
 * @description: 开始节点
 * @author: Cheng Zhi
 * @create: 2023-01-09 12:30
 **/
public class StartNode extends AbstractNode {

    public StartNode(MxCell mxCell) {
        super(mxCell);
    }

    @Override
    public void verify() {

    }

    @Override
    public void runNode(NodeCallBack callBack) throws Exception{
        // 初始化工作
        SeleniumFactory seleniumFactory = new SeleniumChromeFactory();
        // todo 这里可以判断一下浏览器
        RemoteWebDriver driver = (ChromeDriver) seleniumFactory.createWebDriver();
        setDriver(driver);
        driver.get(mxCell.getMxObjectData().get("context")); // 这里一般获取到的都是待测试的页面url;

    }

    @Override
    public String getName() {
        return mxCell.getName();
    }
}
